<div class="main-content">
    <div class="section__content section__content--p20">
        <div class="container-fluid">
            <div class="row m-b-30">
                <div class="col-lg-12">
                    <div class="overview-wrap">
                        <h2 class="title-1">查看反馈</h2>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="table-responsive table--no-card m-b-30">
                        <table class="table table-borderless table-striped table-earning">
                            <thead>
                            <tr>
                                <th>内容</th>
                                <th>已读</th>
                                <th>提交时间</th>
                                <th>模块</th>
                                <th>工具</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php
                            if (sizeof($list) > 0) {
                                foreach ($list as $f) {
                                    ?>
                                    <tr>
                                        <td><?php echo $this->csubstr($f['content'], 0, 50, "utf-8", false); ?></td>
                                        <td><?php
                                            if ($f['haveread'] == 0) {
                                                echo "<span class='red'>否</span>";
                                            } else {
                                                echo "是";
                                            }
                                            ?></td>
                                        <td><?php echo $f['createtime']; ?></td>
                                        <td><?php echo $f->module->category; ?></td>
                                        <td class="w80">
                                            <button type="button" class="btn btn-primary btn-sm"  onclick="view(<?php echo $f['feedback_id']; ?>)">查看</button>
                                            <button type="button" class="btn btn-danger btn-sm"  data-toggle="modal" data-target="#confirmModal" onclick="del(<?php echo $f['feedback_id']; ?>)">删除</button>
                                        </td>
                                    </tr>
                                    <?php
                                }
                            }
                            ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="row ">
                <div class="col-lg-12 text-center">
                    <div style="display: inline-block;"><?php
                        $this->widget('CLinkPager', array(
                                'header' => '',
                                'firstPageLabel' => '首页',
                                'lastPageLabel' => '末页',
                                'prevPageLabel' => '上一页',
                                'nextPageLabel' => '下一页',
                                'pages' => $pages,
                                "selectedPageCssClass"=>'active',
                                'htmlOptions' => Array('class' => 'pagination pagination_customize')
                            )
                        );
                        ?></div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    function view(id) {
        window.location.href = "index.php?r=admin/feedback/view&id=" + id;
    }
    function del(id) {
        $("#confirmModal_text").text('确定删除回复？');
        $("#confirmModalButton").bind("click",function () {
            $.get('index.php?r=admin/feedback/del&id=' + id, null, function (result) {
                if (result.type == true) {
                    window.location.reload();
                } else {
                    alert(result.message);
                }
            }, 'json');
        });
    }
</script>